package at.jku.ssw.fortress.ui.assistant;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.swt.graphics.Image;

import at.jku.ssw.fortress.ui.ImageConstants;
import at.jku.ssw.fortress.ui.Shorthand;
import at.jku.ssw.fortress.util.ImageManager;

public class UnicodeProposer {
	
	private List<Proposal> proposals = new ArrayList<Proposal>();
	
	private ImageManager imageManager = new ImageManager();
	private Image UNICODE = imageManager.getImage(ImageConstants.ICON_UNICODE);
	
	private static final Shorthand[] greek = {
		new Shorthand("0391","ALPHA"),
		new Shorthand("03B1","alpha"),
		new Shorthand("0392","BETA"), 
		new Shorthand("03B2","beta"),
		new Shorthand("0393","GAMMA"), 
		new Shorthand("03B3","gamma"),
		new Shorthand("0394","DELTA"), 
		new Shorthand("03B4","delta"),
		new Shorthand("0395","EPSILON"), 
		new Shorthand("03B5","epsilon"),
		new Shorthand("0396","ZETA"), 
		new Shorthand("03B6","zeta"),
		new Shorthand("0397","ETA"), 
		new Shorthand("03B7","eta"),
		new Shorthand("0398","THETA"), 
		new Shorthand("03B8","theta"),
		new Shorthand("0399","IOTA"), 
		new Shorthand("03B9","iota"),
		new Shorthand("039A","KAPPA"), 
		new Shorthand("03BA","kappa"),
		new Shorthand("039B","LAMDA"), 
		new Shorthand("03BB","lambda"),
		new Shorthand("039C","MU"), 
		new Shorthand("03BC","mu"),
		new Shorthand("039D","NU"), 
		new Shorthand("03BD","nu"),
		new Shorthand("039E","XI"), 
		new Shorthand("03BE","xi"),
		new Shorthand("039F","OMICRON"), 
		new Shorthand("03BF","omicron"),
		new Shorthand("03A0","PI"), 
		new Shorthand("03C0","pi"),
		new Shorthand("03A1","RHO"), 
		new Shorthand("03C1","rho"),
		new Shorthand("03A3","SIGMA"), 
		new Shorthand("03C3","sigma"),
		new Shorthand("03A4","TAU"), 
		new Shorthand("03C4","tau"),
		new Shorthand("03A5","UPSILON"), 
		new Shorthand("03C5","upsilon"),
		new Shorthand("03A6","PHI"), 
		new Shorthand("03C6","phi"),
		new Shorthand("03A7","CHI"), 
		new Shorthand("03C7","chi"),
		new Shorthand("03A8","PSI"), 
		new Shorthand("03C8","psi"),
		new Shorthand("03A9","OMEGA"), 
		new Shorthand("03C9","omega"),
	};
	
	public UnicodeProposer() {
		for(Shorthand s : greek) {
			proposals.add(new Proposal(s.unicodeString(), s.name, UNICODE, s.name,"The greek letter <b>"+s.unicodeString()+"</b>"));
		}
		for(Shorthand s : OperatorShorthands.encodedEnclosing) {
			proposals.add(new Proposal(s.unicodeString() + "#{CURSOR}" + s.unicodeString(), s.name + " . " + s.name, UNICODE, s.name, "The unicode enclosing <b>"+s.unicodeString()+"</b>"));
		}
		for(int i = 0; i <  OperatorShorthands.encodedL2R.length; i+=2) {
			Shorthand left = OperatorShorthands.encodedL2R[i];
			Shorthand right = OperatorShorthands.encodedL2R[i+1];
			proposals.add(new Proposal(left.unicodeString() + "#{CURSOR}" + right.unicodeString(), left.name + " . " + right.name, UNICODE, left.name, "The unicode bracket pair <b>"+left.unicodeString()+" . "+right.unicodeString()+"</b>"));
		}
		for(Shorthand s : OperatorShorthands.encodedOps) {
			proposals.add(new Proposal(s.unicodeString(), s.name, UNICODE, s.name, "The unicode operator <b>"+s.unicodeString()+"</b>"));
		}
	}
	
	public List<Proposal> getProposals() {
		return proposals;
		
	}

}
